package com.jeff.springWebTestNG.persistence.ibatis.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import com.jeff.springWebTestNG.persistence.data.User2;

/**
 * this persister use traditional xml to store sql script
 * @author zhou.zhefu
 *
 */
@Service
public interface IUser2Mapper {
	List<User2> getAll();
	List<User2> getByAddress(String address);
	User2 getByName(String name);
	
	//multiple params:
	//1. annotate @Param on each param
	//2. wrap params into a map instance as param
	User2 getByAddressAndName(@Param("address") String address, @Param("name") String name);
	User2 getByAddressAndName2(Map params);
	
	//use list for IN statement
	List<User2> getByIds(List<Integer> idList);
	List<User2> getByAddressList(List<String> addressList);
	List<User2> getByAddressListAndNames(@Param("addressList") List<String> addressList, @Param("names") List<String> names);
	
	void update(User2 user);
	void addUser(User2 user);
	User2 getById(int id);
	void deleteAll(); 
}
